namespace cnVery.bbs.Controls
{
    using cnVery.bbs.Kernel;
    using cnVery.Utils;
    using System;
    using System.Configuration;
    using System.Text;
    using System.Web.UI;

    public class ArchiverXmlAppInfoNode : Control
    {
        private double _processedTime;
        private byte _queries;

        private string GetContent()
        {
            string s = Fetch.UserBrowser.Trim();
            if (s.EndsWith("Firefox"))
            {
                s = "Firefox";
            }
            string str2 = Fetch.CurrentUrl.ToLower();
            str2 = str2.Substring(0, str2.IndexOf("/archiver")) + "/archiver/xml/";
            string str3 = System.Configuration.ConfigurationManager.AppSettings["FileExtension"];
            switch (str3)
            {
                case null:
                case "":
                    str3 = ".aspx";
                    break;
            }
            StringBuilder builder = new StringBuilder();
            builder.Append("<AppInfo>\r\n");
            builder.AppendFormat("\t\t<ForumName>{0}</ForumName>\r\n", Text.TextEncode(Property.bbsName));
            builder.AppendFormat("\t\t<Version>{0}</Version>\r\n", Property.bbsVersion);
            builder.AppendFormat("\t\t<ProcessTime>{0}</ProcessTime>\r\n", this._processedTime);
            builder.AppendFormat("\t\t<Queries>{0}</Queries>\r\n", this._queries);
            builder.AppendFormat("\t\t<UserAgent>{0}</UserAgent>\r\n", Text.TextEncode(s));
            builder.AppendFormat("\t\t<BaseHref>{0}</BaseHref>\r\n", str2);
            builder.AppendFormat("\t\t<FileExtension>{0}</FileExtension>\r\n", str3);
            builder.Append("\t</AppInfo>");
            return builder.ToString();
        }

        protected override void Render(HtmlTextWriter output)
        {
            output.Write(this.GetContent());
        }

        public double ProcessedTime
        {
            set
            {
                this._processedTime = value;
            }
        }

        public byte Queries
        {
            set
            {
                this._queries = value;
            }
        }
    }
}

